package com.kancy.spring.boot.drools.utils;

import org.kie.api.KieServices;
import org.kie.api.runtime.KieContainer;

import java.util.Objects;

/**
 * @author kancy
 * @date 2020/1/18 17:25
 **/
public class KieUtils {

    private static KieContainer kieContainer;

    public static KieContainer getKieClasspathContainer() {
        if (Objects.isNull(kieContainer)){
            synchronized (KieUtils.class){
                if (Objects.isNull(kieContainer)){
                    kieContainer = KieServices.get().getKieClasspathContainer();
                }
            }
        }
        return kieContainer;
    }

    public static void setKieClasspathContainer(KieContainer kieContainer) {
        KieUtils.kieContainer = kieContainer;
    }


}
